package sg.edu.nus.iss.umpire.service.umpire;

import sg.edu.nus.iss.umpire.domain.Umpire;
import sg.edu.nus.iss.umpire.support.HttpMethod;
import sg.edu.nus.iss.umpire.support.Service;
import sg.edu.nus.iss.umpire.support.ServiceConfig;
import sg.edu.nus.iss.umpire.support.ServiceContext;

@ServiceConfig(path = "umpires/edit", method = HttpMethod.GET)
public class EditUmpirePage implements Service {

	@Override
	public String serve(ServiceContext ctx) throws Exception {
		String key = ctx.getRequest().getParameter("key");
		ctx.getRequest().setAttribute("umpire",
				ctx.getEntityManager().find(Umpire.class, Long.valueOf(key)));
		return "umpires/form";
	}

}
